let winObjIndex = {}

function waitObj(winObj) {
    return new Promise(function(resolve) {
        return setTimeout(() => {
            if (window[winObj]) {
                resolve(window[winObj]);
                return;
            }
            winObjIndex[winObj] = (winObjIndex[winObj] || 0) + 1
            if (winObjIndex[winObj] > 4) {
                console.log('等待对象加载失败，可能是因为网络超时-', winObj)
                return;
            }
        }, 1000);
    });
}

const UtilWaitObj = {
    waitObj
}

export default UtilWaitObj